package cn.hycat.algorithm;

import java.util.ArrayList;

/**
 * 堆
 * @author 吕泽浩业
 * @version 1.0
 */
public class Single {
    private static volatile Single instance;

    private Single(){}

    public static Single getInstance() {
        if(instance == null) { // 2.已创建完成单例对象，不用进入syn代码块，直接放行
            synchronized (Single.class) { //1.防止其他线程
                if(instance == null) {
                    instance = new Single();
                }
            }
        }
        return instance;
    }
}
